<template>
  <el-date-picker
    v-model="value2"
    align="right"
    type="date"
    :placeholder="placeholder"
    :picker-options="pickerOptions1"
    size="small"
  >
  </el-date-picker>
</template>


<script>
export default {
  name: "y-date",
  props:{
    placeholder:String
  },
  data() {
    return {
      pickerOptions1: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            },
          },
          {
            text: "昨天",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24);
              picker.$emit("pick", date);
            },
          },
          {
            text: "一周前",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", date);
            },
          },
        ],
      },
      value1: "",
      value2: "",
    };
  },
};
</script>

<style lang="scss" scoped>
</style>